package ygflower.domain;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

@Entity
public class User {
	public static String CLASSNAME = "User";
	
	public static String PropertyID = "id";
	public static String PropertyName = "name";
	public static String PropertyPassword = "password";
	public static String PropertyIsman = "isman";
	public static String PropertyPhone = "phone";
	public static String PropertyAddress = "description";
	public static String PropertyCreate = "create";
	public static String PropertyLastModified = "LastModified";

	private int id;
	private String name;
	private String password;
	private boolean isman;
	private String phone;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isIsman() {
		return isman;
	}

	public void setIsman(boolean isman) {
		this.isman = isman;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public User() {
		super();
	}

	public User(String name, String password) {
		super();
		this.name = name;
		this.password = password;
	}

	private String address;
	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate;


	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Transient
	private Date lastModified;

	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	public Date getLastModified() {
		return lastModified;
	}

	public static boolean intToBool(int i) {
		if (i == 0) {
			return false;
		} else {
			return true;
		}
	}
}
